package kr.hkit.powerjava.chapter14;

import java.awt.Color;
import java.awt.HeadlessException;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

class exercise04 extends JFrame {
	
	JLabel labels[];

	public exercise04() throws HeadlessException {
		JPanel p = new JPanel(); 
		p.setLayout(null);
		
		labels = new JLabel[30]; //배열 크기 생성
		
		for (int i = 0; i < 30; i++) {
			labels[i] = new JLabel("" + i);
			int x = (int) (500 * Math.random());
			int y = (int) (200 * Math.random());
			labels[i].setForeground(Color.MAGENTA);
			labels[i].setLocation(x, y);
			labels[i].setSize(500, 200);
			p.add(labels[i]);
		}
		add(p);
		setVisible(true);
	}
}

public class Exercise04Test {
	public static void main(String[] args) {
		new exercise04();
	}
}
